<?php
namespace frontend\helps\events;

use yii;
use yii\base\Component;
use yii\base\Event;

class Cat extends Component {
	public function shout(){
		echo 'miao 事件触发 <br>';
		$me=new MyEvent;
		$me->mes();
		$me->message='测试event的第二个参数<br>'; #可替换初始的数据
		$this->trigger('miao',$me);
	}

}


class MyEvent extends Event{
	public $message;

	public function mes(){
 	  return $this->message='初始化数据<br>';
	}
}


 ?>